#include "faceDetector.h"

#include "cv.h"
#include <highgui.h>
#include <iostream>

using namespace std;
using namespace cv;


int main( int argc, const char** argv ) {

	FaceDetector* fd = new FaceDetector(1.0);
	
	//TODO : Use resource tracker
	
	//FIX : Is this actually RGB, or might it be something else?
	
	//Mat image = imread( "../../samples/facetest1.jpg", 1 );
	
	Mat image = imread( argv[1], 1 ); //TODO asking for bad input!
	
	
	cout << "rows " << image.rows << endl; 
	
	cout << "cols " << image.cols << endl; 
	
	vector<Rect>* faces = fd->detectFace(image);
	
	if (!faces->empty()) {
		vector<Rect>::const_iterator r = faces->begin();
		
		Scalar color = CV_RGB(0,128,255);
		
		rectangle( image, cvPoint(r->x, r->y), cvPoint(r->x+r->width, r->y + r->height), color, 3);
		
		cv::imshow( "result", image );
		
		cvWaitKey(0);
		
		cvDestroyWindow("result");
	} else {
		cout << "no face found" << endl;
	}
	
	return 0;

}